/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.GUI.setting;

import ac.ui.controls.PCLPanel;
import ac.uitls.propertiesOperation;

/**
 *
 * @author ismail
 */
public class genSetting extends PCLPanel {

    /**
     * Creates new form genSetting
     */
    ac.ui.custemItmes c = new ac.ui.custemItmes();
    ac.ui.utils u = new ac.ui.utils();
    propertiesOperation po = new propertiesOperation();
    ac.engin.setting.genSetting gs = new ac.engin.setting.genSetting();

    public genSetting() {
        initComponents();
        onLoad();
        monLoad();
    }

    private void monLoad() {

        // u.panelupdateLabels(this.getComponents());
        String[] lanv = {"en", "ar"};
        String[] lant = {"Englesh", "عربي"};
        c.comBoxFill(lang_cb, lanv, lant);

        String[] stylet = {"default"};
        String[] styletv = {"default"};
        c.comBoxFill(style_cb, stylet, styletv);

        ac.ui.custemItmes.comBoxSetSelectonByValue(lang_cb, gs.getGenSetting()[0]);
        ac.ui.custemItmes.comBoxSetSelectonByValue(style_cb, gs.getGenSetting()[1]);

        if (gs.getGenSetting()[2].equals("1")) {
            jch_viewInfoAuto.setSelected(true);
        } else {
            jch_viewInfoAuto.setSelected(false);
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        pCLCheckBoxBeanInfo1 = new ac.ui.controls.PCLCheckBoxBeanInfo();
        jToolBar2 = new javax.swing.JToolBar();
        update_bt = new javax.swing.JButton();
        default_bt = new javax.swing.JButton();
        lang_cb = new javax.swing.JComboBox();
        style_cb = new javax.swing.JComboBox();
        jch_viewInfoAuto = new ac.ui.controls.PCLCheckBox();
        pCLLabel1 = new ac.ui.controls.PCLLabel();
        pCLLabel2 = new ac.ui.controls.PCLLabel();

        jLabel1.setText("jLabel1");

        jToolBar2.setRollover(true);

        update_bt.setText("bt_update");
        update_bt.setFocusable(false);
        update_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        update_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        update_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                update_btActionPerformed(evt);
            }
        });
        jToolBar2.add(update_bt);

        default_bt.setText("bt_default");
        default_bt.setFocusable(false);
        default_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        default_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        default_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                default_btActionPerformed(evt);
            }
        });
        jToolBar2.add(default_bt);

        lang_cb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ar", "en", " " }));

        style_cb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "default" }));

        jch_viewInfoAuto.setText("jlb_viewInfoAuto");

        pCLLabel1.setText("jlb_lang");

        pCLLabel2.setText("lb_style");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jch_viewInfoAuto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
                    .addComponent(style_cb, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lang_cb, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lang_cb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(style_cb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jch_viewInfoAuto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void update_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_update_btActionPerformed

        String c = "0";
        if (jch_viewInfoAuto.isSelected()) {
            c = "1";
        }
        String[] items = {ac.ui.custemItmes.comBoxGetValue(lang_cb), (String) ac.ui.custemItmes.comBoxGetValue(style_cb), c};

        u.sendMessage(this, po.getWord("label.saveUpdate"), gs.updateSetting(items));
    }//GEN-LAST:event_update_btActionPerformed

    private void default_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_default_btActionPerformed

        u.sendMessage(this, po.getWord("label.saveUpdate"), gs.defSetting());
    }//GEN-LAST:event_default_btActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton default_bt;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JToolBar jToolBar2;
    private ac.ui.controls.PCLCheckBox jch_viewInfoAuto;
    private javax.swing.JComboBox lang_cb;
    private ac.ui.controls.PCLCheckBoxBeanInfo pCLCheckBoxBeanInfo1;
    private ac.ui.controls.PCLLabel pCLLabel1;
    private ac.ui.controls.PCLLabel pCLLabel2;
    private javax.swing.JComboBox style_cb;
    private javax.swing.JButton update_bt;
    // End of variables declaration//GEN-END:variables
}
